#include <chrono>
#include <iostream>
#include <mutex>
#include <thread>
int count = 0;
std::mutex count_mutex;
void increment() {
  for (int i = 0; i < 3; i++) {
    count_mutex.lock();
    ++count;
    std::cout << "Current Thread Id: " << std::this_thread::get_id()
              << " count = " << count << "\n";
    count_mutex.unlock();
  }
}
int main() {
  std::thread t1 = std::thread(increment);
  std::thread t2 = std::thread(increment);
  t1.join();
  t2.join();
}
